
package net.vinote.smart.platform.module.database.tool;

import java.lang.reflect.Field;

/**
 * get方法为public,set方法包可见
 */
public final class Column
{
	/** 列名 */
	private String name;

	/** 数据类型 */
	private int dataType;

	/** 是否为主键 */
	private boolean isPrimaryKey;

	/** 描述列的注释 */
	private String remarks;

	public String getName()
	{
		return name;
	}

	void setName(String name)
	{
		this.name = name;
	}


	public int getDataType()
	{
		return dataType;
	}

	void setDataType(int dataType)
	{
		this.dataType = dataType;
	}

	public boolean isPrimaryKey()
	{
		return isPrimaryKey;
	}

	void setPrimaryKey(boolean isPrimaryKey)
	{
		this.isPrimaryKey = isPrimaryKey;
	}

	public String getRemarks()
	{
		return remarks;
	}

	void setRemarks(String remarks)
	{
		this.remarks = remarks;
	}

	@Override
	public String toString()
	{
		StringBuffer sb = new StringBuffer(this.getClass().getSimpleName()
				+ "[\r\n");
		for (Field f : this.getClass().getDeclaredFields())
		{
			try
			{
				sb.append(f.getName()).append(":").append(f.get(this))
						.append("\r\n");
			}
			catch (IllegalArgumentException e)
			{
				e.printStackTrace();
			}
			catch (IllegalAccessException e)
			{
				e.printStackTrace();
			}
		}
		sb.append("]");
		return sb.toString();
	}

}
